<?php
class Mageex_AdvancedMenu_Block_AdvancedMenu extends Mage_Core_Block_Template
{
    public function _prepareLayout()
    {
		if (!Mage::getStoreConfig('advancedmenu/general/enabled')) return;
        $layout = $this->getLayout();
        
        $head = $layout->getBlock('head');
		if(Mage::getStoreConfig('advancedmenu/general/style') == 'horizontal'){
			$layout->getBlock('catalog.topnav')->setTemplate('advancedmenu/top.phtml');
			$head->addItem('js', 'advancedmenu/custommenu.js');
			$head->addItem('skin_css', 'advancedmenu/custommenu.css');
		}else{
			$head->addItem('js', 'advancedmenu/verticalmenu.js');
			$head->addItem('skin_css', 'advancedmenu/verticalmenu.css');
		}
    }

    private static function _isIE6()
    {
        return isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/\bmsie [1-6]/i', $_SERVER['HTTP_USER_AGENT']);
    }
     public function getAdvancedMenu()     
     { 
        if (!$this->hasData('advancedmenu')) {
            $this->setData('advancedmenu', Mage::registry('advancedmenu'));
        }
        return $this->getData('advancedmenu');
       
    }
}